using System;

namespace MathService
{
    public class LambdaToStringObjectIndicator<T>
    {
        private readonly Func<T, string> f_Converter;
        public T Value { get; private set; }

        public LambdaToStringObjectIndicator(T t, Func<T, string> Converter)
        {
            f_Converter = Converter;
            Value = t;
        }

        public override string ToString() { return f_Converter(Value); }

        public static implicit operator T(LambdaToStringObjectIndicator<T> Indicator) { return Indicator.Value; }

        public static explicit operator string(LambdaToStringObjectIndicator<T> Indicator) { return Indicator.ToString(); }
    }
}